UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gTqkbF3pcEmjaLFwAfWlpiejKwIYtQkRjersZQKPhwg=' 
WHERE 
  key_id = 'e800eaad9437795ffd04facaadc6508996ab10d95c65f6cb57e8db1079513649' 
  AND (
    token = 'gTqkbF3pcEmjaLFwAfWlpiejKwIYtQkRjersZQKPhwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035