UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vO05+2VJIS+9ItkD4uDqwZt5CBvrQycjHekATMUpveY=' 
WHERE 
  key_id = '6124b15f63cda244429a14ef97bd64b5378545c4decccf502f76494fe17fe3a2' 
  AND (
    token = 'vO05+2VJIS+9ItkD4uDqwZt5CBvrQycjHekATMUpveY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025