UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XPwx3WOoih/XVWoflAie4oMms5RC77X3ddFRixwB/+0=' 
WHERE 
  key_id = '054b01d0da4aa78299fbb37c27077136d67e190e1b6b5f5ec82be8d22e7fdb16' 
  AND (
    token = 'XPwx3WOoih/XVWoflAie4oMms5RC77X3ddFRixwB/+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036