UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IDXJhkuQn9Mq4y3dM2Rw3Qyd0jKWzmNwyot7ddBREoA=' 
WHERE 
  key_id = 'fd5210a001a3aa63a7e3d50533f6f623c99e5d915cad592a2f8458b688a180a1' 
  AND (
    token = 'IDXJhkuQn9Mq4y3dM2Rw3Qyd0jKWzmNwyot7ddBREoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024