UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yRLk73uJYDZFDAJYtZ2YGUuz7pphySO8vyRxfnTeuXI=' 
WHERE 
  key_id = '605374e9f01304476fb703f8cb01a2157da6f9fb105d0b74dc104672288f52a0' 
  AND (
    token = 'yRLk73uJYDZFDAJYtZ2YGUuz7pphySO8vyRxfnTeuXI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037