UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lPAhM+c8qfOvv7RLXP/s3DzQ5gDeSEmrZvh4zeqzx+s=' 
WHERE 
  key_id = '06f7b834a00a5140dba9d0cfb03ece57fbc663f0d3eb758869dd66ec14174cef' 
  AND (
    token = 'lPAhM+c8qfOvv7RLXP/s3DzQ5gDeSEmrZvh4zeqzx+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030