UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TgezRC71dj16ppBRGHvETONTzopIKxXVzpg3EtZeBWI=' 
WHERE 
  key_id = '19dc1054f028be4de42c8b0fce4db7236256c470a8c184a49260381bb4c11b69' 
  AND (
    token = 'TgezRC71dj16ppBRGHvETONTzopIKxXVzpg3EtZeBWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037