UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3ZcGVtloqqpwWPEgAEGpV4UULnxXGKJC72pkchZywJU=' 
WHERE 
  key_id = 'cd31eff52140048467b39d2bad70d2b176aa98ce6d344b1048bd8bd05ed5afcb' 
  AND (
    token = '3ZcGVtloqqpwWPEgAEGpV4UULnxXGKJC72pkchZywJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023