UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KwMbxM7KVw12ovh1WjV7WIfBrQvj+jyeKoeLsZxwE3Q=' 
WHERE 
  key_id = '74f46547696d07d29a2efb2915f586df5a08c0a7eab2c045f0f5a650689c9669' 
  AND (
    token = 'KwMbxM7KVw12ovh1WjV7WIfBrQvj+jyeKoeLsZxwE3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025