UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eG2eCCv+Pp4/BypbJIGf2JRAfBcbxZGX4b99aBIN5bY=' 
WHERE 
  key_id = '3950569b0e60719604676f1125a7e990657d1712ffd8375e8013ed660f722055' 
  AND (
    token = 'eG2eCCv+Pp4/BypbJIGf2JRAfBcbxZGX4b99aBIN5bY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027