UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0lCxXiM0dV85229lCkm9ariTEWDijf+8m/mF+gKEsbY=' 
WHERE 
  key_id = '1f9519ce462f0ef4893e5cef7776e6a31ab8341ebc1e05ebe7a7370c392f4aff' 
  AND (
    token = '0lCxXiM0dV85229lCkm9ariTEWDijf+8m/mF+gKEsbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030