UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6DR9yCcwRiXtL8CqnLwHsBjSZhIWc78sDgAvoqqYUf8=' 
WHERE 
  key_id = 'aebd0c1df9150b469dbb79ee4e136eb4e605709c24cbe9f2fd98b5e2be560e5d' 
  AND (
    token = '6DR9yCcwRiXtL8CqnLwHsBjSZhIWc78sDgAvoqqYUf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024