UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gngla93eA+YjnBSTmXzrojIJWiImRZbbudE76ubCGzY=' 
WHERE 
  key_id = '7f278aa5ab38b507c21769920cab1b92c75e203e73052731e1d488a075ee642f' 
  AND (
    token = 'Gngla93eA+YjnBSTmXzrojIJWiImRZbbudE76ubCGzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030