UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fDP8Vef4BRZ8PxxSwPzyFG509brhEGCWS9RwTwH0xRc=' 
WHERE 
  key_id = '11612f17a67abd94964c48e345e82f8a15282575daa7f36b6434f86483b561a5' 
  AND (
    token = 'fDP8Vef4BRZ8PxxSwPzyFG509brhEGCWS9RwTwH0xRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037