UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YUhodIkMGeEhDC+t/Tgb0kGQ0eloJyaNFUB0ttw3SxY=' 
WHERE 
  key_id = '680a65955211aa05a6eec6900662f6536fe8de8afd3a96962fc8ebe8c6a9acf3' 
  AND (
    token = 'YUhodIkMGeEhDC+t/Tgb0kGQ0eloJyaNFUB0ttw3SxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049