UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KuuscxxoxvqUDymFldhn4ih77BwLTEH71Ktq2mjS8wU=' 
WHERE 
  key_id = '2d1ecaff5a5b7209b3fd90fe22a23c752734d9e0d4e0e51a2f036c4cb48492d3' 
  AND (
    token = 'KuuscxxoxvqUDymFldhn4ih77BwLTEH71Ktq2mjS8wU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026