UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QekPrRicUcUJxszdIKJOjsWTsZTkWHxENOofWt+L9as=' 
WHERE 
  key_id = '152d5ce1806406a3078bd4ff684f73f645488fce9e8baf70e07b318459bae044' 
  AND (
    token = 'QekPrRicUcUJxszdIKJOjsWTsZTkWHxENOofWt+L9as=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022