UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cArgeTHCNR0s6UjIS+XCvsAAnrSD8jg/IxBxQGOWJLI=' 
WHERE 
  key_id = '1cff4b23b6cfe4bf5eb10ac6cf46bc1787e929887ada9617acf9f63e7a0755a5' 
  AND (
    token = 'cArgeTHCNR0s6UjIS+XCvsAAnrSD8jg/IxBxQGOWJLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038