UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GnhDcHszyUnWTH7xeVseS1Wx2gcLJ32LtVp1J3IpTWU=' 
WHERE 
  key_id = '8ec49f55a9bb2d957a3ad2facd16933e309b579feeb190e5dfb4ab70722e4ffb' 
  AND (
    token = 'GnhDcHszyUnWTH7xeVseS1Wx2gcLJ32LtVp1J3IpTWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047