UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dHTyk2liEniZa44+QFtKIEiGed3QT7F5g7nHWYwQbAM=' 
WHERE 
  key_id = '5687256b921067bd31cda1245ce02353091a8fefdfbb264508521744fd02b713' 
  AND (
    token = 'dHTyk2liEniZa44+QFtKIEiGed3QT7F5g7nHWYwQbAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036