UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vFt9Q5xx3CVowyad6e8B7lqt1jKSU085zV3shly3G28=' 
WHERE 
  key_id = '9158c1c20b3c91a6e654370b5582b67c353e1543a000774a526a52dc0ca513f0' 
  AND (
    token = 'vFt9Q5xx3CVowyad6e8B7lqt1jKSU085zV3shly3G28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022