UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ILHDoYQkB3gfZ3x726ZRLXk+znUEc1c/2XjQU7anv+g=' 
WHERE 
  key_id = '820edfcd6f5a9c81983ab3e1557343541013054129847a9521e313445960cc6c' 
  AND (
    token = 'ILHDoYQkB3gfZ3x726ZRLXk+znUEc1c/2XjQU7anv+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016