UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'anIHr6+5bhv5uZ7MXdbmYX0Oa6U1oQCc8nK1IhNMkC8=' 
WHERE 
  key_id = 'adcb3a417e7ff6acad8c713d5b7d5b815daee569c0cf42752fd55c33c37d180d' 
  AND (
    token = 'anIHr6+5bhv5uZ7MXdbmYX0Oa6U1oQCc8nK1IhNMkC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040