UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jz+Wdh82h2mbkEBuF1QNpcYKbJpk+SOe6OrfnYX5R3E=' 
WHERE 
  key_id = '06b7295990ee8914e3058a0b00f6b07a92c06e6cce2bebb1882db02861aeeea2' 
  AND (
    token = 'Jz+Wdh82h2mbkEBuF1QNpcYKbJpk+SOe6OrfnYX5R3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016