UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '660LBaTafIutOK/9clxIm6gabTPEchOD8Z/c/nyWQJc=' 
WHERE 
  key_id = '599f902b7d113a5a2a9d01bbed626415fe91d93cadd61c18cec5faac3d5520a3' 
  AND (
    token = '660LBaTafIutOK/9clxIm6gabTPEchOD8Z/c/nyWQJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026